package thirdly;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class CopyFile {
	public static void main(String[] args) throws IOException {
		File onefile = new File("D:\\新建文件夹\\Wildlife.wmv");
		File twofile = new File("D:\\bb\\animal.wmv");
		FileInputStream fis = new FileInputStream(onefile);
		FileOutputStream fos=new FileOutputStream(twofile);
		byte[] buffer=new byte[1024];
		while(true)
		{
		if(fis.available()<1024)
		{
			int a=fis.read();
			while(a!=-1){
				a=fis.read();
				fos.write(a);
			}
			break;
		}
		System.out.println(fis.available());
		fis.read(buffer);
		fos.write(buffer);
		}
		fis.close();
		fos.flush();
		fos.close();
	}
}
